<template>
  <div class="roleList-nav">
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="table-nav">
      <el-table :data="roleList" border stripe style="width: 100%">
        <el-table-column type="index" width="50" />
        <el-table-column prop="authName" label="权限名称" min-width="100" />
        <el-table-column prop="path" label="路径" min-width="200" />
        <el-table-column label="权限等级" min-width="100">
          <template #default="scope">
            <div>
              <el-tag :type="tagType[scope.row.level]" size="large">{{
                levelName[scope.row.level]
              }}</el-tag>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script setup>
import { getAllList } from "@/api/roleList";
import { reactive } from "vue";
let roleList = reactive([]);
let tagType = ["", "success", "warning"];
let levelName = ["一级", "二级", "三级"];
let getList = async () => {
  let res = await getAllList("list");
  roleList.splice(0, roleList.length);
  roleList.push(...res.data);
};
getList();
</script>

<style lang="scss" scoped>
.roleList-nav {
  position: relative;
  width: 100%;
  // height: 100%;
  overflow: auto;
  .table-nav {
    position: absolute;
    width: 100%;
    // max-height: 100%;
    padding: 20px;
    box-sizing: border-box;
    margin-top: 10px;
    background-color: white;
    overflow: hidden;
    .el-table {
      margin: 20px 0;
    }
    .pagination-nav {
    }
  }
}
</style>